#ifndef __COMMU_H
#define __COMMU_H

#include <arpa/inet.h>

#define u8 unsigned char
#define u16 unsigned short

#define I2C_CMD_SET_IP_ADDRESS                  0x0e
#define I2C_CMD_GET_REAL_INFO		    	0x13
#define I2C_CMD_USUAL_SEND_AND_RECV             0xaa

#define PACK_CMD_HEAD_0  'U'
#define PACK_CMD_HEAD_1  'B'

#define COM_BUF_SIZE        1024
#define COM_HEAD_SIZE       6
#define MAX_NAME_LEN        64
#define HEAD_LEN            2
#define CMD_LEN             2
#define CRC_LEN             2
#define MAX_PACK_SIZE       2048

typedef struct commu_pack {
    u8 head[HEAD_LEN];
    u8 cmd[CMD_LEN];
    u16 data_len;
    u8 buff[MAX_PACK_SIZE - COM_HEAD_SIZE];
} __attribute__((packed)) T_commu_pack, *P_commu_pack;

typedef struct _andr_board_real_info {
    int sysup_sec;
    float cpu_usage;
    int gpu_usage;
    float cpu_temp;
    float gpu_temp;
    int mem_usage;
    int flash_available;
    struct in_addr ip_addr;
    int container_info_status;
    int script_execution_status;
} __attribute__((packed)) T_andr_real_info, *P_andr_real_info;

typedef struct _network_config {
    char identifier;
    uint32_t ipAddress[4];
} __attribute__((packed)) T_network_config, *P_network_config;

#endif /* __COMMU_H */